< previous page page_193 next page >

Page 193
            longdata, BufferSize)
            LabelOutput = LabelOutput & Hex$(longdata)
         Case REG_BINARY
            LabelOutput = "Binary: "
            ReDim binarydata(BufferSize - 1)
            res = RegQueryValueEx(hKey, ValueName, 0, DataType, _
            binarydata(0), BufferSize)
            For x = 0 To BufferSize - 1
               hexval = Hex$(binarydata(x))
               If Len(hexval) = 1 Then hexval = "0" & hexval
               hexval = " " & hexval
               LabelOutput = LabelOutput & hexval
            Next x
         Case Else
            LabelOutput = "Unsupported data type"
      End Select
   lblValue.Caption = LabelOutput
   End If
End Sub
Conclusion
Sure, I could have created a buggy version of the DisplayValue routine for you to fix, but this function provides a perfect opportunity for learning to deal with parameters that handle multiple data types. If you were able to come up with solutions using either (or both) of the approaches described here, congratulationsyou are now an advanced API programmer and are well on your way to guru status (if you're not already there).

 
< previous page page_193 next page >